# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test03
# Description:  值传递和引用传递
# Author:       ASUS
# Date:         2019/3/7
#-------------------------------------------------------------------------------

# 值传递
x = 20
s = "世界你好"
def ceshi(x,s):
    x = 40
    s = "hello world"
    print("内部x和s",x,s)                 #内部x和s 40 hello world
    print("内部x：",id(x))
    print("内部s：", id(s))
ceshi(x,s)
print("外部x和s",x,s)                     #外部x和s 20 世界你好
print("外部x：",id(x))
print("外部s：",id(s))
# 引用传递
x = {"a":30,"b":20}
y = ["a","b","c"]
def ceshi1(x,y):
    x["a"] = 100
    y[1] ="abcd"
    print("内部x和y:",x,y)                 #内部x和y: {'a': 100, 'b': 20} ['a', 'abcd', 'c']
ceshi1(x,y)
print("外部x和y：",x,y)                    #外部x和y： {'a': 100, 'b': 20} ['a', 'abcd', 'c']


